home *** CD-ROM | disk | FTP | other *** search
/ Micromanía 92 / CDMM92_1.ISO / SOF 2 SDK / sof2sdk-101.msi / _92D6AC311BB48EBA344BBABC89DA6AB0 / _57309F8496E34D829163B8FE68FED03D < prev    next >
Encoding:
Text File  |  2001-11-21  |  2.7 KB  |  72 lines

  1. // bg_lib.h -- standard C library replacement routines used by code
  2. // compiled for the virtual machine
  3.  
  4. // This file is NOT included on native builds
  5.  
  6. typedef int size_t;
  7.  
  8. typedef char *  va_list;
  9. #define _INTSIZEOF(n)   ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
  10. #define va_start(ap,v)  ( ap = (va_list)&v + _INTSIZEOF(v) )
  11. #define va_arg(ap,t)    ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
  12. #define va_end(ap)      ( ap = (va_list)0 )
  13.  
  14. #define CHAR_BIT      8         /* number of bits in a char */
  15. #define SCHAR_MIN   (-128)      /* minimum signed char value */
  16. #define SCHAR_MAX     127       /* maximum signed char value */
  17. #define UCHAR_MAX     0xff      /* maximum unsigned char value */
  18.  
  19. #define SHRT_MIN    (-32768)        /* minimum (signed) short value */
  20. #define SHRT_MAX      32767         /* maximum (signed) short value */
  21. #define USHRT_MAX     0xffff        /* maximum unsigned short value */
  22. #define INT_MIN     (-2147483647 - 1) /* minimum (signed) int value */
  23. #define INT_MAX       2147483647    /* maximum (signed) int value */
  24. #define UINT_MAX      0xffffffff    /* maximum unsigned int value */
  25. #define LONG_MIN    (-2147483647L - 1) /* minimum (signed) long value */
  26. #define LONG_MAX      2147483647L   /* maximum (signed) long value */
  27. #define ULONG_MAX     0xffffffffUL  /* maximum unsigned long value */
  28.  
  29. // Misc functions
  30. typedef int cmp_t(const void *, const void *);
  31. void qsort(void *a, size_t n, size_t es, cmp_t *cmp);
  32. void    srand( unsigned seed );
  33. int        rand( void );
  34.  
  35. // String functions
  36. size_t strlen( const char *string );
  37. char *strcat( char *strDestination, const char *strSource );
  38. char *strcpy( char *strDestination, const char *strSource );
  39. int strcmp( const char *string1, const char *string2 );
  40. char *strchr( const char *string, int c );
  41. char *strstr( const char *string, const char *strCharSet );
  42. char *strncpy( char *strDest, const char *strSource, size_t count );
  43. int tolower( int c );
  44. int toupper( int c );
  45.  
  46. double atof( const char *string );
  47. double _atof( const char **stringPtr );
  48. int atoi( const char *string );
  49. int _atoi( const char **stringPtr );
  50.  
  51. int vsprintf( char *buffer, const char *fmt, va_list argptr );
  52. int sscanf( const char *buffer, const char *fmt, ... );
  53.  
  54. // Memory functions
  55. void *memmove( void *dest, const void *src, size_t count );
  56. void *memset( void *dest, int c, size_t count );
  57. void *memcpy( void *dest, const void *src, size_t count );
  58.  
  59. // Math functions
  60. double ceil( double x );
  61. double floor( double x );
  62. double sqrt( double x );
  63. double sin( double x );
  64. double cos( double x );
  65. double atan2( double y, double x );
  66. double tan( double x );
  67. int abs( int n );
  68. double fabs( double x );
  69. double acos( double x );
  70. double asin( double x );
  71.  
  72.